using System;
using OhioState.AssetManaged;
using OhioState.Math;

namespace OhioState.Graphics.Proxy
{
    [Serializable]
    public class Plane :SharedAsset, IPlane
    {
        private ShapeType _shapeType;
        private Vector3 _point;
        public Vector3 Point
        {
            get { return _point; }
            set 
            { 
                _point = value;
                FireUpdateChangedEvent(this);
            }           
        }       
        
        private Vector3 _normal = new Vector3(0.0f,-1.0f,0.0f);
        public Vector3 Normal
        {
            get { return _normal; }
            set 
            { 
                _normal = value;
                FireUpdateChangedEvent(this);
            }
        }

        public Plane(): base("")
        {
            _point = new Vector3(0.5f, 0.5f, 0.5f);
            _normal = new Vector3(0.0f, 0.0f, 1.0f);
            _shapeType = ShapeType.Plane;
        }

        public Plane(String name): base(name)
        {
            _point = new Vector3(0.5f, 0.5f, 0.5f);
            _normal = new Vector3(0.0f, 0.0f, 1.0f);
            _shapeType = ShapeType.Plane;
        }
        public Plane(Vector3 point, Vector3 normal): base("")
        {
            _point = point;
            //normalize ?
            _normal = normal;
            _shapeType = ShapeType.Plane;
        }

        public Plane(String name, Vector3 point, Vector3 normal)
            : base(name)
        {
          _point = point;
          //normalize ?
          _normal = normal;
          _shapeType = ShapeType.Plane;
        }
        /// <summary>
        /// Overrides shared object ToString method
        /// </summary>
        /// <returns>A string representing parent shared object name</returns>
        public override String ToString()
        {
            return base.Name;
        }
        public ShapeType ShapeType
        {
            get { return _shapeType; }
        }
    }
}
